﻿<Page
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
	  x:Class="MovieRental_Presentation.LoanDialog" 
      d:DesignWidth="900" d:DesignHeight="500"
      mc:Ignorable="d"
      WindowTitle="Movie Rental"
	  MinWidth="900"
	  MinHeight="500" 
      ShowsNavigationUI="False">

	<Grid x:Name="LayoutRoot" Background="{StaticResource backgroundBrush}">
		<Border BorderBrush="{StaticResource borderBrush}" BorderThickness="{StaticResource borderThickness}" Margin="8" Padding="{StaticResource borderPadding}" CornerRadius="{StaticResource borderCornerRadius}">
			<Grid Margin="0">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition/>
				</Grid.RowDefinitions>
				<TextBlock Margin="8,8,0,0" Text="New Loan" FontSize="{StaticResource dialogGiantTitleTextSize}" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{StaticResource borderBrush}"/>
				<Button x:Name="backButton" Content="Back" HorizontalAlignment="Right" Width="60" VerticalAlignment="Center" Height="60" Margin="0,0,8,0" Click="backButton_Click"/>
				<Border BorderBrush="{StaticResource borderBrush}" BorderThickness="{StaticResource borderThickness}" Height="3" VerticalAlignment="Bottom"/>
				<Grid Margin="0" Grid.Row="1" DataContext="{Binding CurrentCart}">
					<Grid.RowDefinitions>
						<RowDefinition Height="*"/>
						<RowDefinition Height="*"/>
						<RowDefinition Height="*"/>
						<RowDefinition Height="*"/>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="*"/>
						<RowDefinition Height="Auto"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="1*"/>
						<ColumnDefinition Width="2*"/>
					</Grid.ColumnDefinitions>
					<TextBlock Margin="0,0,8,0" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Text="Customer"/>
					<TextBlock Margin="0,0,8,0" TextWrapping="Wrap" Text="Personal Discount" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="1" VerticalAlignment="Center"/>
					<TextBlock Margin="0,0,8,0" TextWrapping="Wrap" Text="Cart Discount" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="2" VerticalAlignment="Center"/>
					<Border Grid.Row="4" BorderBrush="{StaticResource borderBrush}" BorderThickness="{StaticResource borderThickness}" Grid.ColumnSpan="3" Margin="0,0,0,-0.001" Height="3"/>
					<TextBlock Text ="{Binding CustomerName}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}"  Grid.Column="1" Margin="8,0,0,0"/>
					<DataGrid Margin="8" Grid.Column="2" Grid.RowSpan="4" ItemsSource="{Binding Loans}" AutoGenerateColumns="False">
						<DataGrid.Columns>
							<DataGridTextColumn Header="Movie" Binding="{Binding MovieTitle}" Width="*" />
							<DataGridTextColumn Header="Publisher" Binding="{Binding Publisher}" Width="Auto"/>
							<DataGridTextColumn Header="Media Type" Binding="{Binding MediaTypeName}" Width="Auto"/>
							<DataGridTextColumn Header="Price" Binding="{Binding Path=Entity.PricePerDay, StringFormat=\{0:c\}}" Width="Auto"/>
						</DataGrid.Columns>
					</DataGrid>
					<TextBlock Text="{Binding Path=PersonalDiscountValue, StringFormat=\{0\}%}" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="1" VerticalAlignment="Center" Grid.Column="1" Margin="8,0,0,0"/>
					<TextBlock Text="{Binding Path=CartDiscountValue, StringFormat=\{0\}%}" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="2" Grid.Column="1" Margin="8,0,0,0"  VerticalAlignment="Center"/>
					<TextBlock Margin="0,0,8,0" TextWrapping="Wrap" Text="Initial Price" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="3"  VerticalAlignment="Center"/>
					<TextBlock Text="{Binding Path=InitialCost, StringFormat=\{0:c\}}" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="3" VerticalAlignment="Center" Grid.Column="1" Margin="0"/>
					<TextBlock Text="Total Price" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="5" VerticalAlignment="Center"/>
					<TextBlock Text="{Binding Path=TotalCost, StringFormat=\{0:c\}}" HorizontalAlignment="Left" Foreground="{StaticResource inputBoxBrush}" FontSize="{StaticResource dialogElementFontSize}" Grid.Row="5" Grid.Column="1" Margin="0" VerticalAlignment="Center"/>
					<Grid Grid.Row="6" Grid.ColumnSpan="3" Grid.Column="0">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="*"/>
						</Grid.ColumnDefinitions>
						<Button Grid.Column="0" Margin="0,0,8,0" Content="Accept" VerticalAlignment="Top" Height="30" Name="acceptButton" Click="acceptButton_Click" />
						<Button Grid.Column="1" Margin="8,0,0,0" Content="Cancel" VerticalAlignment="Center" Height="30"/>
						
					</Grid>
				</Grid>
			</Grid>
		</Border>
	</Grid>
</Page>